package com.cn.bio;

import lombok.extern.slf4j.Slf4j;

import java.io.*;
import java.net.Socket;
import java.text.SimpleDateFormat;
import java.util.Date;

@Slf4j
public class Client {

  public static void main(String[] args) {
    try {
      for (int i = 0; i < 1; i++) {
        Socket socket = new Socket("localhost", 8090);
        OutputStream outputStream = socket.getOutputStream();
        PrintWriter printWriter = new PrintWriter(outputStream);
        printWriter.println(" hello word !!! " + i + " " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.sss").format(new Date()));
        printWriter.flush();

        InputStream inputStream = socket.getInputStream();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
        String s = bufferedReader.readLine();
        log.info(s);
        bufferedReader.close();
      }
    } catch (IOException e) {
      e.printStackTrace();
    }

  }

}
